Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not attach ui after parse #200

Merged
merged 4 commits into from
Dec 15, 2016
Merged

Do not attach ui after parse #200

merged 4 commits into from
Dec 15, 2016

Conversation

ccorcos
Copy link
Contributor

@ccorcos ccorcos commented Dec 2, 2016

There are a few reasons for this PR.

  1. I think its a good idea to be able to use Vorpal simply as a CLI tool without necessarily having to use the interactive shell when using .parse

  2. I was having some issues where I was starting an express server with a Vorpal command and I would listen to SIGINT and SIGTERM to gracefully shutdown the server, but then I would get this bizarre Error: read EIO close error on the next key I typed after exiting with ctrl-c. The only way to solve it was with process.on('SIGINT', () => process.exit(2)). I don't get this error anymore.

Reference Issue: #199

I meant to open up a second PR, but it ended up here as well so why not: #198

It's just adding a simple prototype method on command so you can compose program options. for example.

@ccorcos
Copy link
Contributor Author

ccorcos commented Dec 2, 2016

Also, @dthree after reading your notice, I think I could offer some help. I'm building a project that makes heavy use of Vorpal :) https://github.com/ccorcos/doug/

@ccorcos
Copy link
Contributor Author

ccorcos commented Dec 2, 2016

@scotthovestadt mind taking a look at this?

@LongLiveCHIEF
Copy link
Contributor

I've been having similar issues with vorpal over the last year. We need to make sure that this patch doesn't break any other functionality, and I know we're light on tests.

One of the other issues I've had to work around is the usage of this within action, and I have a feeling this patch will alter this behavior.

We def need some tests for the functionality this patch brings.

I'm not sure how using void 0 is changing any functionality. here since it's being assigned to a variable. Can you speak to what that change fixes?

@@ -193,7 +193,7 @@ var UI = function (_EventEmitter) {
value: function prompt(options, cb) {
var _this2 = this;

var prompt = undefined;
var prompt = void 0;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would prefer the use of the undefined primitive here instead of void 0.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think void 0 is an artifact of the build process.

On doing reviews, makes sure you're looking at src and not dist, as the latter is irrelevant.

@@ -34,7 +34,7 @@ var UI = function (_EventEmitter) {
function UI() {
_classCallCheck(this, UI);

var _this = _possibleConstructorReturn(this, Object.getPrototypeOf(UI).call(this));
var _this = _possibleConstructorReturn(this, (UI.__proto__ || Object.getPrototypeOf(UI)).call(this));
Copy link
Contributor

@LongLiveCHIEF LongLiveCHIEF Dec 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

__proto__ is deprecated, and use is highly discouraged. With the way the command object is currently passed around, this could be destructive for downstream uses.

Should we should be using UI.prototype.constructor instead.

@@ -540,7 +540,7 @@ vorpal._onKeypress = function (key, value) {
vorpal.prompt = function () {
var _this = this;

var options = arguments.length <= 0 || arguments[0] === undefined ? {} : arguments[0];
var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

@dthree
Copy link
Owner

dthree commented Dec 2, 2016

I think this is the most important patch right now. About 4 months ago, some PR broke the parse functionality, so I'm all for this fix.

@ccorcos
Copy link
Contributor Author

ccorcos commented Dec 2, 2016

@LongLiveCHIEF I didnt make any changes to dist other than running gulp build. My changes are just in the two lib files that are super simple

@ccorcos
Copy link
Contributor Author

ccorcos commented Dec 3, 2016

Let me know if there's anything else I can do or when this is published :)

@LongLiveCHIEF
Copy link
Contributor

My bad, I'm so used to /dist being ignored by git that I didn't put 2 and 2 together. I just joined the project, so wanted to make sure the important patches got reviewed first and foremost.

@LongLiveCHIEF
Copy link
Contributor

I think this is the most important patch right now. About 4 months ago, some PR broke the parse functionality, so I'm all for this fix.

I was also going over some of the details of #169 and can see there has been a lot of discussion around parse

@dthree all said... what do you think is needed in order to accept this PR?

@dthree dthree merged commit 1bab7ed into dthree:master Dec 15, 2016
@dthree
Copy link
Owner

dthree commented Dec 15, 2016

This looks fine as is - it's actually a revert really.

@johnthepink
Copy link

@dthree would love to get this in a release <3

@ccorcos
Copy link
Contributor Author

ccorcos commented Jan 24, 2017

@dthree can you please publish this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants